package UIPackage;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.GregorianCalendar;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;

import org.dyno.visual.swing.layouts.Constraints;
import org.dyno.visual.swing.layouts.GroupLayout;
import org.dyno.visual.swing.layouts.Leading;
import Sistem.*;

//VS4E -- DO NOT REMOVE THIS LINE!
public class MusteriOnayGUI extends JFrame {

	private static final long serialVersionUID = 1L;
	private JTextArea jTextArea0;
	private JScrollPane jScrollPane0;
	private Register r;
	private JButton jButton0;
	private static final String PREFERRED_LOOK_AND_FEEL = "javax.swing.plaf.metal.MetalLookAndFeel";
	public MusteriOnayGUI() {
		initComponents();
	}
	public MusteriOnayGUI(Register r){
		this.r=r;
		initComponents();
		jTextArea0.setText("Adı: "+r.getMusteriAdi()+"\n"+
							"Soyadi: "+r.getMusteriSoyadi()+"\n"+
							"Musteri ID: "+r.getMusteriID()+"\n" + 
							"Tipi: " + r.getMusteriTipi()+"\n"+
							"Doğum Tarihi: "+r.getMusteriDogumTarihi());
	}

	private void initComponents() {
		setLayout(new GroupLayout());
		add(getJScrollPane0(), new Constraints(new Leading(58, 201, 10, 10), new Leading(31, 146, 10, 10)));
		add(getJButton0(), new Constraints(new Leading(114, 12, 12), new Leading(222, 10, 10)));
		setSize(320, 287);
	}
	private JButton getJButton0() {
		if (jButton0 == null) {
			jButton0 = new JButton();
			jButton0.setText("Onayla");
			jButton0.addMouseListener(new MouseAdapter() {
	
				public void mouseClicked(MouseEvent event) {
					jButton0MouseMouseClicked(event);
				}
			});
		}
		return jButton0;
	}
	private JScrollPane getJScrollPane0() {
		if (jScrollPane0 == null) {
			jScrollPane0 = new JScrollPane();
			jScrollPane0.setViewportView(getJTextArea0());
		}
		return jScrollPane0;
	}
	private JTextArea getJTextArea0() {
		if (jTextArea0 == null) {
			jTextArea0 = new JTextArea();
		}
		return jTextArea0;
	}
	private static void installLnF() {
		try {
			String lnfClassname = PREFERRED_LOOK_AND_FEEL;
			if (lnfClassname == null)
				lnfClassname = UIManager.getCrossPlatformLookAndFeelClassName();
			UIManager.setLookAndFeel(lnfClassname);
		} catch (Exception e) {
			System.err.println("Cannot install " + PREFERRED_LOOK_AND_FEEL
					+ " on this platform:" + e.getMessage());
		}
	}

	/**
	 * Main entry of the class.
	 * Note: This class is only created so that you can easily preview the result at runtime.
	 * It is not expected to be managed by the designer.
	 * You can modify it as you like.
	 */
	public static void main(String[] args) {
		installLnF();
		SwingUtilities.invokeLater(new Runnable() {
			@Override
			public void run() {
				MusteriOnayGUI frame = new MusteriOnayGUI();
				frame.setDefaultCloseOperation(MusteriOnayGUI.EXIT_ON_CLOSE);
				frame.setTitle("MusteriOnayGUI");
				frame.getContentPane().setPreferredSize(frame.getSize());
				frame.pack();
				frame.setLocationRelativeTo(null);
				frame.setVisible(true);
			}
		});
	}
	private void jButton0MouseMouseClicked(MouseEvent event) {
		r.musteriKayitIsleminiBitir();
		this.hide();
	}

}
